* {
  margin: 0;
  padding: 0;
}
@keyframes rotate {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(180deg);
  }
}
@keyframes rotate-reverse {
  0% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  perspective: 1000px;
  background-image: linear-gradient(200deg, #d82c2c, #610909);
}
.card {
  transform-style: preserve-3d;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  width: 300px;
  height: 450px;
  border-radius: 30px;
  background-color: #3f0506;
  animation: rotate 0.9s cubic-bezier(0.66, -0.47, 0.33, 1.5) forwards;
}
.card:hover {
  animation: rotate-reverse 0.9s cubic-bezier(0.66, -0.47, 0.33, 1.5) forwards;
}
.card .front,
.card .back {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  font-size: 20px;
  color: #fff;
  backface-visibility: hidden;
}
.card .back {
  transform: rotateY(180deg);
}
